/*
 * 人人信用管理有限公司版权所有.
 * 
 * @Description:
 * 
 * @author: liyuliang
 * 
 * @date: 20 Apr 2017 10:44:16 am
 * 
 * 注意：本内容仅限于人人信用管理有限公司内部传阅，禁止外泄以及用于其他的商业目的.
 */

package com.rrx360.common.web.tag.ref;

import java.util.LinkedHashMap;
import java.util.Map;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.tagext.DynamicAttributes;
import javax.servlet.jsp.tagext.TryCatchFinally;

public class BaseTag extends BodyTagSupport implements DynamicAttributes, TryCatchFinally {

  private static final long serialVersionUID = -9127136674048222408L;
  Map<String, Object> attributeMap = new LinkedHashMap<String, Object>();

  public <T> T getAttribute(String name) {
    return (T) attributeMap.get(name);
  }

  public Map<String, Object> getAttributeMap() {
    return attributeMap;
  }

  public void setAttributeMap(Map<String, Object> attributeMap) {
    this.attributeMap = attributeMap;
  }

  public void setDynamicAttribute(String arg0, String name, Object value) throws JspException {
    attributeMap.put(name, value);
  }

  public void doCatch(Throwable arg0) throws Throwable {
    throw arg0;

  }

  public void doFinally() {
    attributeMap.clear();

  }

}
